import { _decorator, animation, Animation, Component, Enum, Node } from 'cc'
import { PlantState, PlantType } from './Global'
const { ccclass, property } = _decorator

@ccclass('Plant')
export class Plant extends Component {
  plantState: PlantState = PlantState.Disable
  @property({ type: Enum(PlantType) })
  public plantType: PlantType

  protected start() {
    this.transitionToDisable()
  }

  update(deltaTime: number) {
    switch (this.plantState) {
      case PlantState.Disable:
        this.disableUpdate()
        break
      case PlantState.Enable:
        this.enableUpdate()
        break
    }
  }

  // 未激活状态
  disableUpdate() {}

  // 激活状态
  enableUpdate() {}

  //
  transitionToDisable() {
    this.plantState = PlantState.Disable
    this.getComponent(animation.AnimationController).enabled = false
  }
  // 帧时间函数方法
  produceSun(){
    console.log('BumSun', '生产阳光-arg:')
  }
}
